#!/bin/bash

mprint() {
  echo -e $(TZ=UTC-8 date +'%Y-%m-%dT%H:%M:%SZ') $*
}

deploy() {
    target=$1

    mprint "Deploy new version."

    cd $HOME/work
    rm -rf $target
    git clone --depth 1 git@gitee.com:wx-rdc/$target.git

    mprint "git clone ok."

    mprint "spawn $target"

    cd $HOME/work/$target
    ./build.sh

    mprint "$target started."
}

deploy "dashboard-service"

deploy "dashboard-web"
